﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IM.Interfaces;
using IM.DataTypes;
using Common.Interfaces;

namespace IM.Core.Extensions
{
	class ContactListItemActivateCommand : IUpdateCommand<User>
    {
		public void Update(User updatePar)
        {
			if (updatePar == null)
				throw new NullReferenceException("ContactListItemActivateCommand: udpatePar is null, User expected.");
            
            var control = IM.GUI.Widgets.WidgetsProvider.Activate().Conversation;

            if (control is IM.GUI.Conversation.ConversationWindow)
            {
                var conversation = control as IM.GUI.Conversation.ConversationWindow;
                conversation.Show(updatePar);
            }
            else
                Logging.Logger.AddWarning("No appropriate conversation window found");
        }
    }
}
